package com.ruoyi.lession.utils;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;

public class ExcelUtil {
    public static int getIntCellValue(HSSFRow row, int index){
        int rtn = 0;
        try {
            HSSFCell cell = row.getCell((short)index);
            rtn = (int)cell.getNumericCellValue();
        } catch (RuntimeException e) {
        }
        return rtn;
    }

    public static String getStringValue(HSSFRow row,int index){
        String rtn = "";
        try {
            HSSFCell cell = row.getCell((short)index);
            rtn = cell.getRichStringCellValue().getString();
        } catch (RuntimeException e) {
        }
        return rtn;
    }

}
